class Animals:
    def __init__(self, name, age, food):  # 创建时自动执行
        # 初始化类的属性
        self.name = name
        self.age = age
        self.food = food

    def sit(self):
        print(f"{self.name}, {self.age}, {self.food} sit")

    def run(self):
        print(f"{self.name}, {self.age}, {self.food} run")

class Dog(Animals): # 类的继承
    def __init__(self, name, age, food):
        super().__init__(name, age, food)
    def speak(self):
        print(f"{self.name},  speak 旺旺")

class Cat(Animals): # 类的继承
    def __init__(self, name, age, food):
        super().__init__(name, age, food)
    def speak(self):
        print(f"{self.name},  speak 喵")


my_dog = Dog('旺财', 6, food='A!')
my_cat = Cat('Meow', 2, food='B!')

my_dog.sit()
my_dog.speak()

my_cat.run()
my_cat.speak()
